import React, { Component } from 'react';
import { pro_list } from "../../../api/index";
import '../../../styles/index/Home/Goods.scss'

// import { InfiniteScroll, List } from 'antd-mobile'

class Goods extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: [],
      num: 1
    }
  }
  async componentDidMount() {
    var res = await pro_list({ count: this.state.num, limitNum: 10 })
    console.log(res.data);
    if (res.data.code == 200) {
      this.setState({ list: res.data.data })
    }
  }
  // 到底了
  loadmore() {
    console.log("到底了");
  }
  render() {
    return (
      <div className='home_goods'>
        {
          this.state.list.map((item, index) => {
            return (
              <figure className='home_goods_item' key={index}>
                <figcaption><img src={item.img1} alt="" /></figcaption>
                <p className='home_goods_item_p1'>{item.proname}</p>
                <p className='home_goods_item_p2'>￥{item.originprice}</p>
              </figure>

            )
          })
        }
        {/* <InfiniteScroll loadMore={this.state.num++} hasMore='true' /> */}
      </div>
    );
  }
}

export default Goods;